diff --git a/keyserver/src/responders/landing-handler.js b/keyserver/src/responders/landing-handler.js
--- a/keyserver/src/responders/landing-handler.js
+++ b/keyserver/src/responders/landing-handler.js
@@ -11,6 +11,7 @@
import {
isValidPrimaryIdentityPublicKey,
isValidSIWENonce,
+ isValidSIWEMessageType,
} from 'lib/utils/siwe-utils.js';
import { getMessageForException } from './utils.js';
@@ -138,6 +139,17 @@
});
return;
}
+ const siweMessageType = req.header('siwe-message-type');
+ if (
+ siweMessageType !== null &&
+ siweMessageType !== undefined &&
+ !isValidSIWEMessageType(siweMessageType)
+ ) {
+ res.status(400).send({
+ message: 'Invalid siwe message type.',
+ });
+ return;
+ }
const [{ jsURL, fontURLs, cssInclude }, LandingSSR] = await Promise.all([
getAssetInfo(),
@@ -200,6 +212,7 @@
basename={routerBasename}
siweNonce={siweNonce}
siwePrimaryIdentityPublicKey={siwePrimaryIdentityPublicKey}
+ siweMessageType={siweMessageType}
/>,
);
reactStream.pipe(res, { end: false });
@@ -209,11 +222,15 @@
const siwePrimaryIdentityPublicKeyString = siwePrimaryIdentityPublicKey
? `"${siwePrimaryIdentityPublicKey}"`
: 'null';
+ const siweMessageTypeString = siweMessageType
+ ? `"${siweMessageType}"`
+ : 'null';
// prettier-ignore
res.end(html`
+